package com.jiahua.admin.biz.action.category;

import java.util.List;

import com.jiahua.admin.biz.service.InventoryCategoryService;
import com.jiahua.user.biz.model.InventoryCategory;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

public class InventoryCategoryListAction extends ActionSupport {

	private static final long serialVersionUID = 5566239973996415245L;

	private List<InventoryCategory> inventoryCategoryList;

	private InventoryCategoryService inventoryCategoryService;

	public void setInventoryCategoryList(List<InventoryCategory> inventoryCategoryList) {
		this.inventoryCategoryList = inventoryCategoryList;
	}

	public List<InventoryCategory> getInventoryCategoryList() {
		return inventoryCategoryList;
	}

	public void setInventoryCategoryService(InventoryCategoryService inventoryCategoryService) {
		this.inventoryCategoryService = inventoryCategoryService;
	}

	@Override
	public String execute() throws Exception {

		inventoryCategoryList = getCategoryList();

		return Action.SUCCESS;
	}

	private List<InventoryCategory> getCategoryList() {
		List<InventoryCategory> list = inventoryCategoryService.listInventoryCategory();
		System.out.println("list.size() : " + list.size());
		return list;
	}

}
